import React, { useEffect, useState } from "react";
// 按需导入
import axios from "../service/index";
import WelcomeSon from "./WelcomeSun";

// 引入样式
import "../css/wel.css";

export default function Welcome() {
  let [list, setList] = useState([]);

  useEffect(() => {
    axios.get("/api/users/statistics/getData").then((res) => {
      // console.log(res);
      setList(res.data);
      console.log(list);
    });
  }, []);

  return (
    <div className="welcome">
      <WelcomeSon id="r1" list={list.gender}></WelcomeSon>
      <WelcomeSon id="r2" list={list.area}></WelcomeSon>
      <WelcomeSon id="r3" list={list.accessFrom}></WelcomeSon>
      <WelcomeSon id="r4" list={list.gender}></WelcomeSon>
    </div>
  );
}
